Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: be possible to customize placeholder #278

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

Kikobeats
Copy link
Member

@Kikobeats Kikobeats commented Mar 13, 2022

This PR contains two things:

  • Associate a class name to be possible to customize placeholder style.
  • Add the ability to provide your own placeholder component.

demo

CleanShot 2022-03-13 at 23 12 29@2x

closes #249

@Kikobeats Kikobeats requested a review from breadadams March 13, 2022 22:16
@@ -39,6 +39,7 @@ const Card = props => {
setData,
url,
apiKey, // destructuring to avoid pass it
placeholderComponent: CardEmpty,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what could be the right naming for this:

  • placeholderComponent
  • skeletonComponent
  • loadingComponent

I think *Component suffix is important to don't confuse it with a regular API parameter option

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another structure for this sort of situation is a components prop, that receives an object where the keys are the component names in PascalCase (this is how react-select handles things).

components={{ PlaceholderComponent: Foo }}

Copy link
Member

@breadadams breadadams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me @Kikobeats, just a couple of questions:

  1. Regarding adding the microlink_card_placeholder className to all placeholder elements. Maybe we should vary it, or add some "secondary" className to easily identify each part of the placeholder.
  2. Should we be adding a classname to the media whilst it's in placeholder mode?
  3. You're not actually using the placeholderComponent prop it seems, is that intentional?

@breadadams
Copy link
Member

breadadams commented Jun 21, 2022

Hey @Kikobeats, what do you think of this implementation? Personally after reviewing it again on GH I think I'd prefer a name such as LoadingComponent, instead of PlaceholderComponent - thoughts?

Thanks

P.s. why's the Netlify preview failed?

Kikobeats and others added 2 commits July 2, 2022 00:54
+ Add new prop for injecting custom loading component
+ Update stories
@vercel
Copy link

vercel bot commented Jul 1, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sdk-hover-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 8, 2023 0:16am
sdk-hover-vanilla ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 8, 2023 0:16am
sdk-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 8, 2023 0:16am
sdk-vanilla ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 8, 2023 0:16am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Styling of card loader
2 participants